<!DOCTYPE html><html><head><title>Coverage</title><script>

headings = [];

onload = function(){
  headings = document.querySelectorAll('h2');
};

onscroll = function(e){
  var heading = find(window.scrollY);
  if (!heading) return;
  var links = document.querySelectorAll('#menu a')
    , link;

  for (var i = 0, len = links.length; i < len; ++i) {
    link = links[i];
    link.className = link.getAttribute('href') == '#' + heading.id
      ? 'active'
      : '';
  }
};

function find(y) {
  var i = headings.length
    , heading;

  while (i--) {
    heading = headings[i];
    if (y >= heading.offsetTop) {
      return heading;
    }
  }
}
</script>
<style>

body {
  font: 14px/1.6 "Helvetica Neue", Helvetica, Arial, sans-serif;
  margin: 0;
  color: #2C2C2C;
  border-top: 2px solid #ddd;
}

#coverage {
  padding: 60px;
}

h1 a {
  color: inherit;
  font-weight: inherit;
}

h1 a:hover {
  text-decoration: none;
}

.onload h1 {
  opacity: 1;
}

h2 {
  width: 80%;
  margin-top: 80px;
  margin-bottom: 0;
  font-weight: 100;
  letter-spacing: 1px;
  border-bottom: 1px solid #eee;
}

a {
  color: #8A6343;
  font-weight: bold;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  margin-top: 20px;
  padding: 0 15px;
  width: 100%;
}

ul li {
  float: left;
  width: 40%;
  margin-top: 5px;
  margin-right: 60px;
  list-style: none;
  border-bottom: 1px solid #eee;
  padding: 5px 0;
  font-size: 12px;
}

ul::after {
  content: '.';
  height: 0;
  display: block;
  visibility: hidden;
  clear: both;
}

code {
  font: 12px monaco, monospace;
}

pre {
  margin: 30px;
  padding: 30px;
  border: 1px solid #eee;
  border-bottom-color: #ddd;
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  -webkit-box-shadow: inset 0 0 10px #eee;
  -moz-box-shadow: inset 0 0 10px #eee;
  overflow-x: auto;
}

img {
  margin: 30px;
  padding: 1px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  -webkit-box-shadow: 0 3px 10px #dedede, 0 1px 5px #888;
  -moz-box-shadow: 0 3px 10px #dedede, 0 1px 5px #888;
  max-width: 100%;
}

footer {
  background: #eee;
  width: 100%;
  padding: 50px 0;
  text-align: right;
  border-top: 1px solid #ddd;
}

footer span {
  display: block;
  margin-right: 30px;
  color: #888;
  font-size: 12px;
}

#menu {
  position: fixed;
  font-size: 12px;
  overflow-y: auto;
  top: 0;
  right: 0;
  margin: 0;
  height: 100%;
  padding: 15px 0;
  text-align: right;
  border-left: 1px solid #eee;
  -moz-box-shadow: 0 0 2px #888
     , inset 5px 0 20px rgba(0,0,0,.5)
     , inset 5px 0 3px rgba(0,0,0,.3);
  -webkit-box-shadow: 0 0 2px #888
     , inset 5px 0 20px rgba(0,0,0,.5)
     , inset 5px 0 3px rgba(0,0,0,.3);
  -webkit-font-smoothing: antialiased;
  background: url("");
}

#menu::after {
  display: block;
  content: '';
  padding-top: 80px;
}

#logo {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: rgba(255,255,255,.1);
  font-size: 11px;
  display: block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  -webkit-border-radius: 20px;
  -moz-border-radius: 20px;
  -webkit-box-shadow: 0 0 3px rgba(0,0,0,.2);
  -moz-box-shadow: 0 0 3px rgba(0,0,0,.2);
  color: inherit;
}

#menu li a {
  display: block;
  color: white;
  padding: 0 35px 0 25px;
  -webkit-transition: background 300ms;
  -moz-transition: background 300ms;
}

#menu li {
  position: relative;
  list-style: none;
}

#menu a:hover,
#menu a.active {
  text-decoration: none;
  background: rgba(255,255,255,.1);
}

#menu li:hover .cov {
  opacity: 1;
}

#menu li .dirname {
  opacity: .60;
  padding-right: 2px;
}

#menu li .basename {
  opacity: 1;
}

#menu .cov {
  background: rgba(0,0,0,.4);
  position: absolute;
  top: 0;
  right: 8px;
  font-size: 9px;
  opacity: .6;
  text-align: left;
  width: 17px;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  padding: 2px 3px;
  text-align: center;
}

#stats:nth-child(2n) {
  display: inline-block;
  margin-top: 15px;
  border: 1px solid #eee;
  padding: 10px;
  -webkit-box-shadow: inset 0 0 2px #eee;
  -moz-box-shadow: inset 0 0 2px #eee;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
}

#stats div {
  float: left;
  padding: 0 5px;
}

#stats::after {
  display: block;
  content: '';
  clear: both;
}

#stats .sloc::after {
  content: ' SLOC';
  color: #b6b6b6;
}

#stats .percentage::after {
  content: ' coverage';
  color: #b6b6b6;
}

#stats .hits,
#stats .misses {
  display: none;
}

.high {
  color: #00d4b4;
}
.medium {
  color: #e87d0d;
}
.low {
  color: #d4081a;
}
.terrible {
  color: #d4081a;
  font-weight: bold;
}

table {
  width: 80%;
  margin-top: 10px;
  border-collapse: collapse;
  border: 1px solid #cbcbcb;
  color: #363636;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
}

table thead {
  display: none;
}

table td.line,
table td.hits {
  width: 20px;
  background: #eaeaea;
  text-align: center;
  font-size: 11px;
  padding: 0 10px;
  color: #949494;
}

table td.hits {
  width: 10px;
  padding: 2px 5px;
  color: rgba(0,0,0,.2);
  background: #f0f0f0;
}

tr.miss td.line,
tr.miss td.hits {
  background: #e6c3c7;
}

tr.miss td {
  background: #f8d5d8;
}

td.source {
  padding-left: 15px;
  line-height: 15px;
  white-space: pre;
  font: 12px monaco, monospace;
}

code .comment { color: #ddd }
code .init { color: #2F6FAD }
code .string { color: #5890AD }
code .keyword { color: #8A6343 }
code .number { color: #2F6FAD }
</style></head><body><div id="coverage"><h1 id="overview">Coverage</h1><div id="menu"><li><a href="#overview">overview</a></li><li><span class="cov high">90</span><a href="#hive.js"><span class="basename">hive.js</span></a></li><a id="logo" href="http://visionmedia.github.com/mocha/">m</a></div><div id="stats" class="high"><div class="percentage">90%</div><div class="sloc">181</div><div class="hits">164</div><div class="misses">17</div></div><div id="files"><div class="file"><h2 id="hive.js">hive.js</h2><div id="stats" class="high"><div class="percentage">90%</div><div class="sloc">181</div><div class="hits">164</div><div class="misses">17</div></div><table id="source"><thead><tr><th>Line</th><th>Hits</th><th>Source</th></tr></thead><tbody><tr><td class="line">1</td><td class="hits"></td><td class="source">// Generated by CoffeeScript 1.4.0</td></tr><tr class="hit"> <td class="line">2</td><td class="hits">1</td><td class="source">var EventEmitter, Stream, each, split, thrift, transport,</td></tr><tr><td class="line">3</td><td class="hits"></td><td class="source">  __slice = [].slice;</td></tr><tr><td class="line">4</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">5</td><td class="hits">1</td><td class="source">Stream = require('stream');</td></tr><tr><td class="line">6</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">7</td><td class="hits">1</td><td class="source">each = require('each');</td></tr><tr><td class="line">8</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">9</td><td class="hits">1</td><td class="source">thrift = require('thrift');</td></tr><tr><td class="line">10</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">11</td><td class="hits">1</td><td class="source">transport = require('thrift/lib/thrift/transport');</td></tr><tr><td class="line">12</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">13</td><td class="hits">1</td><td class="source">EventEmitter = require('events').EventEmitter;</td></tr><tr><td class="line">14</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">15</td><td class="hits">1</td><td class="source">split = module.exports.split = function(hqls) {</td></tr><tr class="hit"> <td class="line">16</td><td class="hits">5</td><td class="source">  var commented;</td></tr><tr class="hit"> <td class="line">17</td><td class="hits">5</td><td class="source">  if (Array.isArray(hqls)) {</td></tr><tr class="miss"> <td class="line">18</td><td class="hits">0</td><td class="source">    return hqls;</td></tr><tr><td class="line">19</td><td class="hits"></td><td class="source">  }</td></tr><tr class="hit"> <td class="line">20</td><td class="hits">5</td><td class="source">  commented = false;</td></tr><tr class="hit"> <td class="line">21</td><td class="hits">5</td><td class="source">  hqls = hqls.split('\n').filter(function(line) {</td></tr><tr class="hit"> <td class="line">22</td><td class="hits">54</td><td class="source">    var skip;</td></tr><tr class="hit"> <td class="line">23</td><td class="hits">54</td><td class="source">    line = line.trim();</td></tr><tr class="hit"> <td class="line">24</td><td class="hits">54</td><td class="source">    skip = false;</td></tr><tr class="hit"> <td class="line">25</td><td class="hits">54</td><td class="source">    if (!commented &amp;&amp; line.indexOf('/*') !== -1) {</td></tr><tr class="hit"> <td class="line">26</td><td class="hits">1</td><td class="source">      commented = '/*';</td></tr><tr class="hit"> <td class="line">27</td><td class="hits">1</td><td class="source">      skip = true;</td></tr><tr class="hit"> <td class="line">28</td><td class="hits">53</td><td class="source">    } else if (!commented &amp;&amp; line === '--') {</td></tr><tr class="hit"> <td class="line">29</td><td class="hits">1</td><td class="source">      commented = '--';</td></tr><tr class="hit"> <td class="line">30</td><td class="hits">1</td><td class="source">      skip = true;</td></tr><tr class="hit"> <td class="line">31</td><td class="hits">52</td><td class="source">    } else if (commented === '/*' &amp;&amp; line.lastIndexOf('*/') !== -1 &amp;&amp; line.lastIndexOf('*/') === (line.length - 2)) {</td></tr><tr class="hit"> <td class="line">32</td><td class="hits">1</td><td class="source">      commented = false;</td></tr><tr class="hit"> <td class="line">33</td><td class="hits">1</td><td class="source">      skip = true;</td></tr><tr class="hit"> <td class="line">34</td><td class="hits">51</td><td class="source">    } else if (commented === '--' &amp;&amp; line === '--') {</td></tr><tr class="hit"> <td class="line">35</td><td class="hits">1</td><td class="source">      commented = false;</td></tr><tr class="hit"> <td class="line">36</td><td class="hits">1</td><td class="source">      skip = true;</td></tr><tr><td class="line">37</td><td class="hits"></td><td class="source">    }</td></tr><tr class="hit"> <td class="line">38</td><td class="hits">54</td><td class="source">    if (line.indexOf('--') === 0) {</td></tr><tr class="hit"> <td class="line">39</td><td class="hits">16</td><td class="source">      skip = true;</td></tr><tr><td class="line">40</td><td class="hits"></td><td class="source">    }</td></tr><tr class="hit"> <td class="line">41</td><td class="hits">54</td><td class="source">    return !commented &amp;&amp; !skip;</td></tr><tr><td class="line">42</td><td class="hits"></td><td class="source">  }).join('\n');</td></tr><tr class="hit"> <td class="line">43</td><td class="hits">5</td><td class="source">  hqls = hqls.split(';');</td></tr><tr class="hit"> <td class="line">44</td><td class="hits">5</td><td class="source">  hqls = hqls.map(function(query) {</td></tr><tr class="hit"> <td class="line">45</td><td class="hits">18</td><td class="source">    return query.trim();</td></tr><tr><td class="line">46</td><td class="hits"></td><td class="source">  });</td></tr><tr class="hit"> <td class="line">47</td><td class="hits">5</td><td class="source">  return hqls = hqls.filter(function(query) {</td></tr><tr class="hit"> <td class="line">48</td><td class="hits">18</td><td class="source">    return query.indexOf('--') !== 0 &amp;&amp; query !== '';</td></tr><tr><td class="line">49</td><td class="hits"></td><td class="source">  });</td></tr><tr><td class="line">50</td><td class="hits"></td><td class="source">};</td></tr><tr><td class="line">51</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">52</td><td class="hits">1</td><td class="source">module.exports.createClient = function(options) {</td></tr><tr class="hit"> <td class="line">53</td><td class="hits">4</td><td class="source">  var client, connection, _ref, _ref1, _ref2, _ref3, _ref4;</td></tr><tr class="hit"> <td class="line">54</td><td class="hits">4</td><td class="source">  if (options == null) {</td></tr><tr class="miss"> <td class="line">55</td><td class="hits">0</td><td class="source">    options = {};</td></tr><tr><td class="line">56</td><td class="hits"></td><td class="source">  }</td></tr><tr class="hit"> <td class="line">57</td><td class="hits">4</td><td class="source">  if ((_ref = options.version) == null) {</td></tr><tr class="miss"> <td class="line">58</td><td class="hits">0</td><td class="source">    options.version = '0.7.1-cdh3u3';</td></tr><tr><td class="line">59</td><td class="hits"></td><td class="source">  }</td></tr><tr class="hit"> <td class="line">60</td><td class="hits">4</td><td class="source">  if ((_ref1 = options.server) == null) {</td></tr><tr class="miss"> <td class="line">61</td><td class="hits">0</td><td class="source">    options.server = '127.0.0.1';</td></tr><tr><td class="line">62</td><td class="hits"></td><td class="source">  }</td></tr><tr class="hit"> <td class="line">63</td><td class="hits">4</td><td class="source">  if ((_ref2 = options.port) == null) {</td></tr><tr class="miss"> <td class="line">64</td><td class="hits">0</td><td class="source">    options.port = 10000;</td></tr><tr><td class="line">65</td><td class="hits"></td><td class="source">  }</td></tr><tr class="hit"> <td class="line">66</td><td class="hits">4</td><td class="source">  if ((_ref3 = options.timeout) == null) {</td></tr><tr class="miss"> <td class="line">67</td><td class="hits">0</td><td class="source">    options.timeout = 1000;</td></tr><tr><td class="line">68</td><td class="hits"></td><td class="source">  }</td></tr><tr class="hit"> <td class="line">69</td><td class="hits">4</td><td class="source">  if ((_ref4 = options.transport) == null) {</td></tr><tr class="hit"> <td class="line">70</td><td class="hits">1</td><td class="source">    options.transport = transport.TBufferedTransport;</td></tr><tr><td class="line">71</td><td class="hits"></td><td class="source">  }</td></tr><tr class="hit"> <td class="line">72</td><td class="hits">4</td><td class="source">  connection = thrift.createConnection(options.server, options.port, options);</td></tr><tr class="hit"> <td class="line">73</td><td class="hits">4</td><td class="source">  client = thrift.createClient(require(&quot;./&quot; + options.version + &quot;/ThriftHive&quot;), connection);</td></tr><tr class="hit"> <td class="line">74</td><td class="hits">4</td><td class="source">  return {</td></tr><tr><td class="line">75</td><td class="hits"></td><td class="source">    connection: connection,</td></tr><tr><td class="line">76</td><td class="hits"></td><td class="source">    client: client,</td></tr><tr><td class="line">77</td><td class="hits"></td><td class="source">    end: connection.end.bind(connection),</td></tr><tr><td class="line">78</td><td class="hits"></td><td class="source">    execute: function(query, callback) {</td></tr><tr class="hit"> <td class="line">79</td><td class="hits">14</td><td class="source">      var emitter;</td></tr><tr class="hit"> <td class="line">80</td><td class="hits">14</td><td class="source">      emitter = new EventEmitter;</td></tr><tr class="hit"> <td class="line">81</td><td class="hits">14</td><td class="source">      process.nextTick(function() {</td></tr><tr class="hit"> <td class="line">82</td><td class="hits">14</td><td class="source">        emitter.emit('before', query);</td></tr><tr class="hit"> <td class="line">83</td><td class="hits">14</td><td class="source">        return client.execute(query, function(err) {</td></tr><tr class="hit"> <td class="line">84</td><td class="hits">14</td><td class="source">          var emitError, lboth, lerror;</td></tr><tr class="hit"> <td class="line">85</td><td class="hits">14</td><td class="source">          if (err) {</td></tr><tr class="hit"> <td class="line">86</td><td class="hits">2</td><td class="source">            emitter.readable = false;</td></tr><tr class="hit"> <td class="line">87</td><td class="hits">2</td><td class="source">            lerror = emitter.listeners('error').length;</td></tr><tr class="hit"> <td class="line">88</td><td class="hits">2</td><td class="source">            lboth = emitter.listeners('both').length;</td></tr><tr class="hit"> <td class="line">89</td><td class="hits">2</td><td class="source">            emitError = lerror || (!lerror &amp;&amp; !lboth &amp;&amp; !callback);</td></tr><tr class="hit"> <td class="line">90</td><td class="hits">2</td><td class="source">            if (emitError) {</td></tr><tr class="hit"> <td class="line">91</td><td class="hits">1</td><td class="source">              emitter.emit('error', err);</td></tr><tr><td class="line">92</td><td class="hits"></td><td class="source">            }</td></tr><tr><td class="line">93</td><td class="hits"></td><td class="source">          } else {</td></tr><tr class="hit"> <td class="line">94</td><td class="hits">12</td><td class="source">            emitter.emit('end', null, query);</td></tr><tr><td class="line">95</td><td class="hits"></td><td class="source">          }</td></tr><tr class="hit"> <td class="line">96</td><td class="hits">14</td><td class="source">          emitter.emit('both', err, query);</td></tr><tr class="hit"> <td class="line">97</td><td class="hits">14</td><td class="source">          if (callback) {</td></tr><tr class="hit"> <td class="line">98</td><td class="hits">9</td><td class="source">            return callback(err, callback);</td></tr><tr><td class="line">99</td><td class="hits"></td><td class="source">          }</td></tr><tr><td class="line">100</td><td class="hits"></td><td class="source">        });</td></tr><tr><td class="line">101</td><td class="hits"></td><td class="source">      });</td></tr><tr class="hit"> <td class="line">102</td><td class="hits">14</td><td class="source">      return emitter;</td></tr><tr><td class="line">103</td><td class="hits"></td><td class="source">    },</td></tr><tr><td class="line">104</td><td class="hits"></td><td class="source">    query: function(query, size) {</td></tr><tr class="hit"> <td class="line">105</td><td class="hits">8</td><td class="source">      var buffer, callback, count, emitter, exec, fetch, handle,</td></tr><tr><td class="line">106</td><td class="hits"></td><td class="source">        _this = this;</td></tr><tr class="hit"> <td class="line">107</td><td class="hits">8</td><td class="source">      if (arguments.length === 2 &amp;&amp; typeof size === 'function') {</td></tr><tr class="miss"> <td class="line">108</td><td class="hits">0</td><td class="source">        callback = size;</td></tr><tr class="miss"> <td class="line">109</td><td class="hits">0</td><td class="source">        size = null;</td></tr><tr><td class="line">110</td><td class="hits"></td><td class="source">      }</td></tr><tr class="hit"> <td class="line">111</td><td class="hits">8</td><td class="source">      exec = function() {</td></tr><tr class="hit"> <td class="line">112</td><td class="hits">7</td><td class="source">        emitter.emit('before', query);</td></tr><tr class="hit"> <td class="line">113</td><td class="hits">7</td><td class="source">        return client.execute(query, function(err) {</td></tr><tr class="hit"> <td class="line">114</td><td class="hits">7</td><td class="source">          var emitError, lboth, lerror;</td></tr><tr class="hit"> <td class="line">115</td><td class="hits">7</td><td class="source">          if (err) {</td></tr><tr class="hit"> <td class="line">116</td><td class="hits">1</td><td class="source">            emitter.readable = false;</td></tr><tr class="hit"> <td class="line">117</td><td class="hits">1</td><td class="source">            lerror = emitter.listeners('error').length;</td></tr><tr class="hit"> <td class="line">118</td><td class="hits">1</td><td class="source">            lboth = emitter.listeners('both').length;</td></tr><tr class="hit"> <td class="line">119</td><td class="hits">1</td><td class="source">            emitError = lerror || (!lerror &amp;&amp; !lboth);</td></tr><tr class="hit"> <td class="line">120</td><td class="hits">1</td><td class="source">            if (emitError) {</td></tr><tr class="hit"> <td class="line">121</td><td class="hits">1</td><td class="source">              emitter.emit('error', err);</td></tr><tr><td class="line">122</td><td class="hits"></td><td class="source">            }</td></tr><tr class="hit"> <td class="line">123</td><td class="hits">1</td><td class="source">            emitter.emit('both', err, query);</td></tr><tr class="hit"> <td class="line">124</td><td class="hits">1</td><td class="source">            return;</td></tr><tr><td class="line">125</td><td class="hits"></td><td class="source">          }</td></tr><tr class="hit"> <td class="line">126</td><td class="hits">6</td><td class="source">          return fetch();</td></tr><tr><td class="line">127</td><td class="hits"></td><td class="source">        });</td></tr><tr><td class="line">128</td><td class="hits"></td><td class="source">      };</td></tr><tr class="hit"> <td class="line">129</td><td class="hits">8</td><td class="source">      if (query) {</td></tr><tr class="hit"> <td class="line">130</td><td class="hits">5</td><td class="source">        process.nextTick(exec);</td></tr><tr><td class="line">131</td><td class="hits"></td><td class="source">      }</td></tr><tr class="hit"> <td class="line">132</td><td class="hits">8</td><td class="source">      buffer = [];</td></tr><tr class="hit"> <td class="line">133</td><td class="hits">8</td><td class="source">      count = 0;</td></tr><tr class="hit"> <td class="line">134</td><td class="hits">8</td><td class="source">      emitter = new Stream;</td></tr><tr class="hit"> <td class="line">135</td><td class="hits">8</td><td class="source">      emitter.size = size;</td></tr><tr class="hit"> <td class="line">136</td><td class="hits">8</td><td class="source">      emitter.readable = true;</td></tr><tr class="hit"> <td class="line">137</td><td class="hits">8</td><td class="source">      emitter.paused = 0;</td></tr><tr class="hit"> <td class="line">138</td><td class="hits">8</td><td class="source">      emitter.query = function(q) {</td></tr><tr class="hit"> <td class="line">139</td><td class="hits">2</td><td class="source">        if (query) {</td></tr><tr class="miss"> <td class="line">140</td><td class="hits">0</td><td class="source">          throw new Error('Query already defined');</td></tr><tr><td class="line">141</td><td class="hits"></td><td class="source">        }</td></tr><tr class="hit"> <td class="line">142</td><td class="hits">2</td><td class="source">        query = q;</td></tr><tr class="hit"> <td class="line">143</td><td class="hits">2</td><td class="source">        exec();</td></tr><tr class="hit"> <td class="line">144</td><td class="hits">2</td><td class="source">        return this;</td></tr><tr><td class="line">145</td><td class="hits"></td><td class="source">      };</td></tr><tr class="hit"> <td class="line">146</td><td class="hits">8</td><td class="source">      emitter.pause = function() {</td></tr><tr class="hit"> <td class="line">147</td><td class="hits">54</td><td class="source">        return this.paused = 1;</td></tr><tr><td class="line">148</td><td class="hits"></td><td class="source">      };</td></tr><tr class="hit"> <td class="line">149</td><td class="hits">8</td><td class="source">      emitter.resume = function() {</td></tr><tr class="hit"> <td class="line">150</td><td class="hits">54</td><td class="source">        this.was = this.paused;</td></tr><tr class="hit"> <td class="line">151</td><td class="hits">54</td><td class="source">        this.paused = 0;</td></tr><tr class="hit"> <td class="line">152</td><td class="hits">54</td><td class="source">        if (this.was) {</td></tr><tr class="hit"> <td class="line">153</td><td class="hits">6</td><td class="source">          return fetch();</td></tr><tr><td class="line">154</td><td class="hits"></td><td class="source">        }</td></tr><tr><td class="line">155</td><td class="hits"></td><td class="source">      };</td></tr><tr class="hit"> <td class="line">156</td><td class="hits">8</td><td class="source">      handle = function(err, rows) {</td></tr><tr class="hit"> <td class="line">157</td><td class="hits">21</td><td class="source">        var emitError, lboth, lerror, row, _i, _len;</td></tr><tr class="hit"> <td class="line">158</td><td class="hits">21</td><td class="source">        if (err) {</td></tr><tr class="miss"> <td class="line">159</td><td class="hits">0</td><td class="source">          emitter.readable = false;</td></tr><tr class="miss"> <td class="line">160</td><td class="hits">0</td><td class="source">          lerror = emitter.listeners('error').length;</td></tr><tr class="miss"> <td class="line">161</td><td class="hits">0</td><td class="source">          lboth = emitter.listeners('both').length;</td></tr><tr class="miss"> <td class="line">162</td><td class="hits">0</td><td class="source">          emitError = lerror || (!lerror &amp;&amp; !lboth);</td></tr><tr class="miss"> <td class="line">163</td><td class="hits">0</td><td class="source">          if (emitError) {</td></tr><tr class="miss"> <td class="line">164</td><td class="hits">0</td><td class="source">            emitter.emit('error', err);</td></tr><tr><td class="line">165</td><td class="hits"></td><td class="source">          }</td></tr><tr class="miss"> <td class="line">166</td><td class="hits">0</td><td class="source">          emitter.emit('both', err, query);</td></tr><tr class="miss"> <td class="line">167</td><td class="hits">0</td><td class="source">          return;</td></tr><tr><td class="line">168</td><td class="hits"></td><td class="source">        }</td></tr><tr class="hit"> <td class="line">169</td><td class="hits">21</td><td class="source">        rows = rows.map(function(row) {</td></tr><tr class="hit"> <td class="line">170</td><td class="hits">273</td><td class="source">          return row.split('\t');</td></tr><tr><td class="line">171</td><td class="hits"></td><td class="source">        });</td></tr><tr class="hit"> <td class="line">172</td><td class="hits">21</td><td class="source">        for (_i = 0, _len = rows.length; _i &lt; _len; _i++) {</td></tr><tr class="hit"> <td class="line">173</td><td class="hits">273</td><td class="source">          row = rows[_i];</td></tr><tr class="hit"> <td class="line">174</td><td class="hits">273</td><td class="source">          if (count === 0) {</td></tr><tr class="hit"> <td class="line">175</td><td class="hits">6</td><td class="source">            emitter.emit('row-first', row, 0);</td></tr><tr><td class="line">176</td><td class="hits"></td><td class="source">          }</td></tr><tr class="hit"> <td class="line">177</td><td class="hits">273</td><td class="source">          emitter.emit('row', row, count++);</td></tr><tr><td class="line">178</td><td class="hits"></td><td class="source">        }</td></tr><tr class="hit"> <td class="line">179</td><td class="hits">21</td><td class="source">        if (rows.length === emitter.size) {</td></tr><tr class="hit"> <td class="line">180</td><td class="hits">15</td><td class="source">          if (!emitter.paused) {</td></tr><tr class="hit"> <td class="line">181</td><td class="hits">10</td><td class="source">            return fetch();</td></tr><tr><td class="line">182</td><td class="hits"></td><td class="source">          }</td></tr><tr><td class="line">183</td><td class="hits"></td><td class="source">        } else {</td></tr><tr class="hit"> <td class="line">184</td><td class="hits">6</td><td class="source">          emitter.emit('row-last', row, count - 1);</td></tr><tr class="hit"> <td class="line">185</td><td class="hits">6</td><td class="source">          emitter.readable = false;</td></tr><tr class="hit"> <td class="line">186</td><td class="hits">6</td><td class="source">          emitter.emit('end', query);</td></tr><tr class="hit"> <td class="line">187</td><td class="hits">6</td><td class="source">          return emitter.emit('both', null, query);</td></tr><tr><td class="line">188</td><td class="hits"></td><td class="source">        }</td></tr><tr><td class="line">189</td><td class="hits"></td><td class="source">      };</td></tr><tr class="hit"> <td class="line">190</td><td class="hits">8</td><td class="source">      fetch = function() {</td></tr><tr class="hit"> <td class="line">191</td><td class="hits">22</td><td class="source">        if (emitter.paused || !emitter.readable) {</td></tr><tr class="hit"> <td class="line">192</td><td class="hits">1</td><td class="source">          return;</td></tr><tr><td class="line">193</td><td class="hits"></td><td class="source">        }</td></tr><tr class="hit"> <td class="line">194</td><td class="hits">21</td><td class="source">        if (emitter.size) {</td></tr><tr class="hit"> <td class="line">195</td><td class="hits">18</td><td class="source">          return client.fetchN(emitter.size, handle);</td></tr><tr><td class="line">196</td><td class="hits"></td><td class="source">        } else {</td></tr><tr class="hit"> <td class="line">197</td><td class="hits">3</td><td class="source">          return client.fetchAll(handle);</td></tr><tr><td class="line">198</td><td class="hits"></td><td class="source">        }</td></tr><tr><td class="line">199</td><td class="hits"></td><td class="source">      };</td></tr><tr class="hit"> <td class="line">200</td><td class="hits">8</td><td class="source">      return emitter;</td></tr><tr><td class="line">201</td><td class="hits"></td><td class="source">    },</td></tr><tr><td class="line">202</td><td class="hits"></td><td class="source">    multi_execute: function(hqls, callback) {</td></tr><tr class="hit"> <td class="line">203</td><td class="hits">2</td><td class="source">      var emitter,</td></tr><tr><td class="line">204</td><td class="hits"></td><td class="source">        _this = this;</td></tr><tr class="hit"> <td class="line">205</td><td class="hits">2</td><td class="source">      emitter = new EventEmitter;</td></tr><tr class="hit"> <td class="line">206</td><td class="hits">2</td><td class="source">      hqls = split(hqls);</td></tr><tr class="hit"> <td class="line">207</td><td class="hits">2</td><td class="source">      each(hqls).on('item', function(next, query) {</td></tr><tr class="hit"> <td class="line">208</td><td class="hits">4</td><td class="source">        var exec;</td></tr><tr class="hit"> <td class="line">209</td><td class="hits">4</td><td class="source">        exec = _this.execute(query, next);</td></tr><tr class="hit"> <td class="line">210</td><td class="hits">4</td><td class="source">        return exec.on('before', function() {</td></tr><tr class="hit"> <td class="line">211</td><td class="hits">4</td><td class="source">          var _ref5;</td></tr><tr class="hit"> <td class="line">212</td><td class="hits">4</td><td class="source">          return (_ref5 = emitter.emit).call.apply(_ref5, [emitter, 'before'].concat(__slice.call(arguments)));</td></tr><tr><td class="line">213</td><td class="hits"></td><td class="source">        });</td></tr><tr><td class="line">214</td><td class="hits"></td><td class="source">      }).on('both', function(err) {</td></tr><tr class="hit"> <td class="line">215</td><td class="hits">2</td><td class="source">        var _ref5, _ref6, _ref7;</td></tr><tr class="hit"> <td class="line">216</td><td class="hits">2</td><td class="source">        if (err) {</td></tr><tr class="hit"> <td class="line">217</td><td class="hits">1</td><td class="source">          (_ref5 = emitter.emit).call.apply(_ref5, [emitter, 'error'].concat(__slice.call(arguments)));</td></tr><tr><td class="line">218</td><td class="hits"></td><td class="source">        } else {</td></tr><tr class="hit"> <td class="line">219</td><td class="hits">1</td><td class="source">          (_ref6 = emitter.emit).call.apply(_ref6, [emitter, 'end'].concat(__slice.call(arguments)));</td></tr><tr><td class="line">220</td><td class="hits"></td><td class="source">        }</td></tr><tr class="hit"> <td class="line">221</td><td class="hits">2</td><td class="source">        (_ref7 = emitter.emit).call.apply(_ref7, [emitter, 'both'].concat(__slice.call(arguments)));</td></tr><tr class="hit"> <td class="line">222</td><td class="hits">2</td><td class="source">        if (callback) {</td></tr><tr class="hit"> <td class="line">223</td><td class="hits">2</td><td class="source">          return callback(err);</td></tr><tr><td class="line">224</td><td class="hits"></td><td class="source">        }</td></tr><tr><td class="line">225</td><td class="hits"></td><td class="source">      });</td></tr><tr class="hit"> <td class="line">226</td><td class="hits">2</td><td class="source">      return emitter;</td></tr><tr><td class="line">227</td><td class="hits"></td><td class="source">    },</td></tr><tr><td class="line">228</td><td class="hits"></td><td class="source">    multi_query: function(hqls, size) {</td></tr><tr class="hit"> <td class="line">229</td><td class="hits">3</td><td class="source">      var query,</td></tr><tr><td class="line">230</td><td class="hits"></td><td class="source">        _this = this;</td></tr><tr class="hit"> <td class="line">231</td><td class="hits">3</td><td class="source">      hqls = split(hqls);</td></tr><tr class="hit"> <td class="line">232</td><td class="hits">3</td><td class="source">      query = this.query();</td></tr><tr class="hit"> <td class="line">233</td><td class="hits">3</td><td class="source">      each(hqls).on('item', function(next, hql, i) {</td></tr><tr class="hit"> <td class="line">234</td><td class="hits">7</td><td class="source">        var exec;</td></tr><tr class="hit"> <td class="line">235</td><td class="hits">7</td><td class="source">        if (hqls.length !== i + 1) {</td></tr><tr class="hit"> <td class="line">236</td><td class="hits">5</td><td class="source">          exec = _this.execute(hql);</td></tr><tr class="hit"> <td class="line">237</td><td class="hits">5</td><td class="source">          exec.on('before', function() {</td></tr><tr class="hit"> <td class="line">238</td><td class="hits">5</td><td class="source">            var _ref5;</td></tr><tr class="hit"> <td class="line">239</td><td class="hits">5</td><td class="source">            return (_ref5 = query.emit).call.apply(_ref5, [query, 'before'].concat(__slice.call(arguments)));</td></tr><tr><td class="line">240</td><td class="hits"></td><td class="source">          });</td></tr><tr class="hit"> <td class="line">241</td><td class="hits">5</td><td class="source">          exec.on('error', function(err) {</td></tr><tr class="hit"> <td class="line">242</td><td class="hits">1</td><td class="source">            var emitError, lboth, lerror;</td></tr><tr class="hit"> <td class="line">243</td><td class="hits">1</td><td class="source">            query.readable = false;</td></tr><tr class="hit"> <td class="line">244</td><td class="hits">1</td><td class="source">            lerror = query.listeners('error').length;</td></tr><tr class="hit"> <td class="line">245</td><td class="hits">1</td><td class="source">            lboth = query.listeners('both').length;</td></tr><tr class="hit"> <td class="line">246</td><td class="hits">1</td><td class="source">            emitError = lerror || (!lerror &amp;&amp; !lboth);</td></tr><tr class="hit"> <td class="line">247</td><td class="hits">1</td><td class="source">            if (emitError) {</td></tr><tr class="hit"> <td class="line">248</td><td class="hits">1</td><td class="source">              query.emit('error', err);</td></tr><tr><td class="line">249</td><td class="hits"></td><td class="source">            }</td></tr><tr class="hit"> <td class="line">250</td><td class="hits">1</td><td class="source">            return query.emit('both', err, query);</td></tr><tr><td class="line">251</td><td class="hits"></td><td class="source">          });</td></tr><tr class="hit"> <td class="line">252</td><td class="hits">5</td><td class="source">          return exec.on('end', function() {</td></tr><tr class="hit"> <td class="line">253</td><td class="hits">4</td><td class="source">            return next();</td></tr><tr><td class="line">254</td><td class="hits"></td><td class="source">          });</td></tr><tr><td class="line">255</td><td class="hits"></td><td class="source">        } else {</td></tr><tr class="hit"> <td class="line">256</td><td class="hits">2</td><td class="source">          return query.query(hql, size);</td></tr><tr><td class="line">257</td><td class="hits"></td><td class="source">        }</td></tr><tr><td class="line">258</td><td class="hits"></td><td class="source">      });</td></tr><tr class="hit"> <td class="line">259</td><td class="hits">3</td><td class="source">      return query;</td></tr><tr><td class="line">260</td><td class="hits"></td><td class="source">    }</td></tr><tr><td class="line">261</td><td class="hits"></td><td class="source">  };</td></tr><tr><td class="line">262</td><td class="hits"></td><td class="source">};</td></tr></tbody></table></div></div></div></body></html>